import Vue from "vue";
import App from "./App.vue";
import VueRouter from "vue-router";
import routerConfig from "./router";
import store from "./store";
import VueLazyload from 'vue-lazyload'
import ElementUI from 'element-ui';
import VueClipboard from 'vue-clipboard2'
import './assets/css/reset.css'
import 'element-ui/lib/theme-chalk/index.css';
import constant from './assets/js/constant'
import ApiSet from './assets/js/ApiSet'
import Utils from './assets/js/Utils'
import Api from './api'


Vue.use(ElementUI);
Vue.use(VueRouter)
Vue.use(VueLazyload)
Vue.use(VueClipboard)

Vue.prototype.CONSTANT = constant;
Vue.prototype.ApiSet = ApiSet;
Vue.prototype.Utils = Utils;
Vue.prototype.sendAxiosPromise = Api.sendAxiosPromise;
Vue.prototype.jsonp = Api.jsonp;
Vue.prototype.getJsonData = Api.getJsonData;

Vue.config.productionTip = false;
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}
const router=new VueRouter(routerConfig);
router.afterEach(function (to, form) {
  if(to.path.indexOf('member') != -1 && form.path.indexOf('member') != -1){
    return
  }
  window.scrollTo(0, 0)
})
window.vm = new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");
